//
//  SignalAssistorDetailEditViewController.h
//  Portable Traffic Signal Assistor
//
//  Created by Hao Xu on 4/1/12.
//  Copyright (c) 2012 TTU. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "XMLParser.h"
#import "Signal.h"
#import "SignalPhase.h"
#import "TrafficSignalTimer.h"
#import "SignalLocationEditMapViewController.h"
#import "SignalCountingViewController.h"
//#import "SignalAssistorDetailEditViewController.h"
enum EnumTextField{
    SignalNameTextField = 0,
    SignalCycleLengthField,
    SignalOffsetField,
    PhaseNoInputTextField,
    PhaseMovementInputTextField,
    PhaseRingInputTextField,
    PhaseGreenInputTextField,
    PhaseYellowInputTextField,
    PhaseAllRedInputTextField
    
} ;
@interface SignalAssistorDetailEditViewController : UIViewController <UITextFieldDelegate,UIPickerViewDelegate, UIPickerViewDataSource>
{
    CGFloat animatedDistance;
}

//@property (nonatomic,retain) UITextField * signalNameTextField;
@property (retain, nonatomic) IBOutlet UITextField *signalNameTextField;
//@property (nonatomic,retain) UITextField * signalCycleLengthField;
@property (retain, nonatomic) IBOutlet UITextField *signalCycleLengthField;
//@property (nonatomic,retain) UILabel * cycleTimerLabel;
@property (retain, nonatomic) IBOutlet UILabel *cycleTimerLabel;
//@property (nonatomic,retain) UILabel * ring1TimerLabel;
@property (retain, nonatomic) IBOutlet UILabel *ring1TimerLabel;
//@property (nonatomic,retain) UILabel * ring2TimerLabel;
@property (retain, nonatomic) IBOutlet UILabel *ring2TimerLabel;
//@property (nonatomic,retain) UITextField * phaseNoInputTextField;
@property (retain, nonatomic) IBOutlet UITextField *phaseNoInputTextField;
//@property (nonatomic,retain) UITextField * phaseMovementInputTextField;
@property (retain, nonatomic) IBOutlet UITextField *phaseMovementInputTextField;
//@property (nonatomic,retain) UITextField * phaseRingInputTextField;
@property (retain, nonatomic) IBOutlet UITextField *phaseRingInputTextField;
//@property (nonatomic,retain) UITextField * phaseGreenInputTextField;
@property (retain, nonatomic) IBOutlet UITextField *phaseGreenInputTextField;
//@property (nonatomic,retain) UITextField * phaseYellowInputTextField;
@property (retain, nonatomic) IBOutlet UITextField *phaseYellowInputTextField;
//@property (nonatomic,retain) UITextField * phaseAllRedInputTextField;
@property (retain, nonatomic) IBOutlet UITextField *phaseAllRedInputTextField;
@property (retain, nonatomic) IBOutlet UITextField *signalOffsetTextField;
//@property (nonatomic,retain) UIButton * addNewPhaseButton;
@property (retain, nonatomic) IBOutlet UIButton *addNewPhaseButton;
@property (retain, nonatomic) IBOutlet UIButton *removePhaseButton;
@property (retain, nonatomic) IBOutlet UIButton *savePhaseEditButton;
@property (retain, nonatomic) IBOutlet UILabel *offsetPhaseLabel;
@property (retain, nonatomic) IBOutlet UIButton *mapButton;

//@property (retain,nonatomic) NSString *timerGroupID;
//@property (retain,nonatomic) NSString *signalID;
@property (nonatomic) int timingRing1GraphPositionX;

@property (nonatomic) int timingRing2GraphPositionX;

@property (nonatomic,retain) NSTimer *timer;

@property (nonatomic,retain) NSMutableArray *ring1LabelList;
@property (nonatomic,retain) NSMutableArray *ring2LabelList;
@property (nonatomic,retain) NSMutableArray* labelList;
@property (nonatomic,retain) NSMutableArray* textFieldList;

@property (nonatomic,retain) TimingPattern *timingPattern;
@property (nonatomic,retain) SubSystem *subSystem;
@property (nonatomic,retain) Agency *agency;
@property (retain,nonatomic) Signal *signal;

@property (retain,nonatomic) NSArray * beginOrEndArray;
@property (retain, nonatomic) IBOutlet UIPickerView *phasePicker;
//@property (retain,nonatomic) UIPickerView       *picker;
@property (retain, nonatomic) IBOutlet UITextField *phaseOffSetText;
@property (retain, nonatomic) SignalPhase *selectedPhase;



- (IBAction)clickAddNewPhaseButton:(id)sender;
- (IBAction)clickRemovePhaseButton:(id)sender;
- (IBAction)clickSaveEditPhaseButton:(id)sender;
//- (id) initWithNibNameTimerGroupIDAndSignalID:(NSString *)nibName timerGroupID:(NSString *)timerGroupID signalID:(NSString *)signalID bundle:(NSBundle *)nibBundle;
- (id) initWithNibNameAndSignal:(NSString *)nibName agency:(Agency *)agency subSystem:(SubSystem *)subSystem timingPattern:(TimingPattern *)timingPattern signal:(Signal *)signal bundle:(NSBundle *)nibBundle;

- (IBAction)textFieldReturn:(id)sender;
- (IBAction)backgroundTouched:(id)sender;
- (IBAction)clickOffsetPhaseButton:(id)sender;

- (IBAction)clickMapButton:(id)sender;


@end
